<template>
  <div class="collection_list">
    <!--    顶部返回按钮-->
    <div class="head_return" @click="headReturn"></div>
    <!-- 个人中心顶部标题 -->
    <div class="personal_tit">
      <img src="../../assets/image/personal/personalTop.png" alt="" />
    </div>
    <div class="record_content">
      <div class="rec_con_tit" v-if="pageType === 'collection'">收藏夹</div>
      <div class="rec_con_tit" v-else>错题库</div>
      <div class="rec_con_return" @click="headReturn">
          <img src="../../assets/image/collection/return.png" alt="">
          <span>返回</span>
      </div>
      <!-- 表格内容区 -->
      <div class="record_table">
        <div class="table_top">
          <div>
            选择时间
            <i class="el-icon-arrow-down" style="margin: auto 0"></i>
          </div>
          <div>
            阅读逻辑
            <i class="el-icon-arrow-down" style="margin: auto 0"></i>
          </div>
        </div>
        <div class="table_con">
          <div class="table_head">
            <div class="time">时间</div>
            <div class="type">类型</div>
            <div class="fraction">分数</div>
            <div class="operation">操作</div>
          </div>
          <div>
            <div
              class="table_item table_head"
              v-for="(item, index) in recordList"
              :key="index"
            >
              <div class="time">{{ item.time }}</div>
              <div class="type">{{ item.type }}</div>
              <div class="fraction">{{ item.fraction }}</div>
              <div class="see operation">操作</div>
            </div>
          </div>
        </div>
        <div class="table_pagin">
          <el-pagination
            class="pagination"
            background
            prev-text="上一页"
            next-text="下一页"
            layout="prev, pager, next"
            :total="1000"
          >
          </el-pagination>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'CollectionList',
  data() {
    return {
        // 页面 默认 收藏夹页面
      pageType: '',
      recordList: [
        { time: "2021-02-26 15:30", type: "阅读逻辑", fraction: "95" },
        { time: "2021-02-26", type: "阅读逻辑", fraction: "95" },
        { time: "2021-02-26", type: "阅读逻辑", fraction: "95" },
        { time: "2021-02-26", type: "阅读逻辑", fraction: "95" },
        { time: "2021-02-26", type: "阅读逻辑", fraction: "95" },
        { time: "2021-02-26", type: "阅读逻辑", fraction: "95" },
        { time: "2021-02-26", type: "阅读逻辑", fraction: "95" },
        { time: "2021-02-26", type: "阅读逻辑", fraction: "95" },
        { time: "2021-02-26", type: "阅读逻辑", fraction: "95" },
        { time: "2021-02-26", type: "阅读逻辑", fraction: "95" },
        { time: "2021-02-26", type: "阅读逻辑", fraction: "95" },
        { time: "2021-02-26", type: "阅读逻辑", fraction: "95" },
        { time: "2021-02-26", type: "阅读逻辑", fraction: "95" },
      ],
    };
  },
  methods: {
    // 返回上一页
    headReturn() {
      this.$router.go(-1);
    },
  },
    watch:{
    pageType(type){
      if(type === 'collection'){
        document.title = '收藏夹列表'
      }else if (type === 'wrong'){
        document.title = '错题库列表'
      } 
    }
  },
  created(){
      this.pageType = this.$route.query.type
      console.log(this.$route.query.type);
  }
};
</script>

<style lang="less" scoped>
.collection_list {
  width: 100vw;
  height: 100vh;
  background: url("../../assets/image/personal/proback.png") no-repeat;
  background-size: 100% 100%;
  .head_return {
    position: absolute;
    z-index: 10;
    top: 0.3rem;
    left: 0.4rem;
    width: 0.7rem;
    height: 0.7rem;
    background: url("../../assets/image/lesson/return.png") no-repeat;
    background-size: 100% 100%;
    cursor: pointer;

    & > img {
      width: 100%;
      height: 100%;
    }
  }
  .personal_tit {
    margin: 0 auto;
    width: 2.65rem;
    height: 1.01rem;
    & > img {
      width: 100%;
    }
  }
  .record_content {
    padding: 0.87rem 0.9rem 0 0.9rem;
    position: relative;
    margin: 0.1rem auto 0 auto;
    width: 16.8rem;
    height: 8.94rem;
    background: url("../../assets/image/personal/recordt.png") no-repeat;
    background-size: 100% 100%;
    box-sizing: border-box;
    .rec_con_tit {
      position: absolute;
      left: 0.33rem;
      top: 0.12rem;
      width: 0.8rem;
      height: 0.18rem;
      color: #fff;
      font-size: 0.16rem;
      cursor: pointer;
    }
    .rec_con_return{
        display: flex;
        height: 0.47rem;
        font-size: 0.14rem;
        color: #8493A3;
        cursor: pointer;
        & > img {
            margin-right: 0.09rem; 
            width: 0.27rem; 
            height: 0.27rem;
        }
    }
    .record_table {
      width: 100%;
      height: 6.72rem;
      background-size: pink;
      .table_top {
        display: flex;
        height: 0.52rem;
        box-sizing: border-box;
        & > div {
          display: flex;
          justify-content: space-between;
          margin-right: 0.12rem;
          padding: 0 0.22rem;
          width: 1.45rem;
          height: 0.32rem;
          line-height: 0.32rem;
          font-size: 0.14rem;
          color: #8ea6c9;
          background: #eef5ff;
          border: 2px solid #e0eaf5;
          border-radius: 0.16rem;
          cursor: pointer;
        }
      }
      .table_con {
        height: 6.2rem;
        overflow: hidden;
        .table_head {
          display: flex;
          padding: 0 0.62rem 0 0.41rem;
          height: 0.48rem;
          line-height: 0.48rem;
          background: #d8e9fb;
          border-radius: 3px;
          font-size: 0.14rem;
          color: #474747;
          .time {
            width: 2.83rem;
          }
          .type {
            width: 3.24rem;
          }
          .fraction {
            width: 7.42rem;
          }
        }
        .table_item {
          background: #f7fbff;
          color: #4d4d4d;
          border-top: 1px solid #dce5f0;
          border-bottom: 1px solid #dce5f0;
          .see {
            margin: auto 0;
            width: 0.58rem;
            height: 0.28rem;
            line-height: 0.28rem;
            text-align: center;
            color: #fff;
            background: #fcb230;
            border-radius: 3px;
            cursor: pointer;
          }
        }
      }
      .table_pagin {
        padding-top: 0.2rem;
        text-align: center;
        height: 0.9rem;
        box-sizing: border-box;
        /deep/.pagination {
          button {
            color: #818181 !important;
            border: none;
            & > span {
              font-size: 0.14rem !important;
            }
          }
          .el-pager {
            .number {
              font-weight: 400;
              color: #b7b7b7;
            }
          }
        }
      }
    }
  }
}
</style>